@extends('admin.main')

@section('content')
<div class="wrapper wrapper-content">
	<div class="ibox float-e-margins">
		<div class="ibox-title">
			<h5>Meta设置</h5>
		</div>
		<div class="ibox-content">
			<form id="formSiteinfo" method="post" class="form-horizontal">
        <div class="form-group">
          <label class="col-sm-2 control-label">网站名称</label>
          <div class="col-sm-10">
            <input type="text" name="name" value="{{$meta['name']}}" class="form-control" required=""></div>
        </div>
        <div class="hr-line-dashed"></div>
        <div class="form-group">
          <label class="col-sm-2 control-label">网站标题</label>
          <div class="col-sm-10">
            <input type="text" name="title" value="{{$meta['title']}}" class="form-control" required=""></div>
        </div>
        <div class="hr-line-dashed"></div>
        <div class="form-group">
          <label class="col-sm-2 control-label">关 键 词</label>
          <div class="col-sm-10">
            <input type="text" name="keywords" value="{{$meta['keywords']}}" class="form-control" required="">
            <span class="help-block m-b-none">多个关键词之间，请用“,”隔开</span>
          </div>
        </div>
        <div class="hr-line-dashed"></div>
        <div class="form-group">
          <label class="col-sm-2 control-label">网站描述</label>
          <div class="col-sm-10">
            <textarea id="ueditor_description" name="description">{{$meta['description']}}</textarea>
          </div>
        </div>
        <div class="hr-line-dashed"></div>
        <div class="form-group">
          <label class="col-sm-2 control-label">统计代码</label>
          <div class="col-sm-10">
            <textarea name="tongji" rows="7" class="form-control">{{$tongji}}</textarea>
          </div>
        </div>
        <div class="hr-line-dashed"></div>
        <div class="form-group">
          <div class="col-sm-4 col-sm-offset-2">
            <button class="btn btn-success" type="submit"><i class="fa fa-save"></i> 保存配置</button>
          </div>
        </div>
      </form>
		</div>
	</div>
</div>
@endsection

@section('pagescript')
<script src="{{asset('assets/ueditor/ueditor.config.js')}}"></script>
<script src="{{asset('assets/ueditor/ueditor.all.js')}}"></script>
<script>
  var ueditor;
	$("#sidebar li[rel='siteconfig']").addClass("active")
		.find("ul").addClass("in")
		.find("li[rel='1']").addClass("active");

  $(function(){
    ueditor = UE.getEditor('ueditor_description');
  });

	$("#formSiteinfo").on('submit', function(){
    var that = this;
    $(this).find(":submit").attr("disabled", "disabled");
    var url = '/admin/siteconfig/set-meta';
    $.post(url, $(this).serialize(), function(data){
      $(that).find(":submit").removeAttr("disabled");
      var d = dialog({title:null,content:'<i class="fa fa-check-circle"></i>修改成功'}).show();
			setTimeout(function(){d.close().remove();}, 2000);
    }).fail(failure);
    return false;
  });
</script>
@endsection
